package edu.kjxy.day02Synchronized.t3;

/**
 * 功能:如果getValue不是同步的方法，则会出现脏读现象
 * 作者:程序员欧阳子韩
 * 日期:2024/2/1 19:28
 */
public class RunTest {
    public static void main(String[] args) {
        try {
            PublicVar publicVarRef = new PublicVar();
            ThreadA threadA = new ThreadA(publicVarRef);
            threadA.start();
            Thread.sleep(200);//打印结果受此值影响
            publicVarRef.getValue();
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
}
